<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="javax.jdo.PersistenceManager"%>
<%@ page import="com.google.appengine.api.users.User"%>
<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@ page import="com.fesp.EntityAthlete"%>
<%@ page import="com.fesp.PMF"%>
<%@ page import="com.google.appengine.api.datastore.DatastoreService"%>
<%@ page import="com.google.appengine.api.datastore.DatastoreServiceFactory"%>
<%@ page import="com.google.appengine.api.datastore.Entity"%>
<%@ page import="com.google.appengine.api.datastore.PreparedQuery"%>
<%@ page import="com.google.appengine.api.datastore.Query"%>

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>FESP Planner</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<%
		UserService userService = UserServiceFactory.getUserService();
		User user = userService.getCurrentUser();
	%>

	<div id="masthead">
		<ul id="top_menu">
			<%
				if (user != null) {
			%>
			<li><a href="<%=userService.createLogoutURL("/index.jsp")%>">Log
					Off</a></li>
			<%
				} else {
			%>
			<li><a
				href="<%=userService.createLoginURL(request.getRequestURI())%>">Log
					In</a></li>
			<%
				}
			%>
			<%
				if (user != null) {
			%>
			<li><a href="/student/statistics.jsp">Statistics</a></li>
			<%
				}
			%>
			<li><a href="/student/calendar.jsp">Calendar</a></li>
			<li><a href="/student/planner.jsp">Planner</a></li>
			<li><a href="/index.jsp">Home</a></li>
		</ul>
		<div id="filler"></div>

		<%
			if (user != null) {
		%>
		<div id="user_container">
			<div id="user_info">
				<li>&nbsp;</li>
				<li>Welcome, <font color="#99b910">user</font>! <br>Modify
					your <a href="/student/settings.jsp">settings!</a><br>Last
					logged in: 00:00</li>
				<li>&nbsp;</li>
			</div>
		</div>
		<%
			}
		%>
	</div>

	<div id="page_content">

		<table>
			<tr>
				<td class="col1">

					<div class="roundcont">
						<div class="roundtop">
							<img src="/images/topl.gif" alt="" width="15" height="15"
								class="corner" style="display: none" />
						</div>

						<%
							// Change this.
							/*DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
							Query q = new Query("EntityAthlete");
							q.addFilter("athlete", Query.FilterOperator.EQUAL, user);
							PreparedQuery pq = datastore.prepare(q);
		
							Entity result = pq.asSingleEntity();
							if (result == null) {*/
						%>
						
						<br/>
						<center><h2>Planner</h2></center></br>
						
						<p>We have detected that you have not set up your planner yet. Please spend a few
						minutes filling out the next couple of forms to register your course information into
						our database. Have course-related information nearby for fast referencing.</p></br>

						<form action="/createPlanner" method="get">
							<table align="center">
								<tr>
									<td width="150">Number of classes</td>
									<td>
										<select name="num_classes">
											<option value="2">2</option>
											<option value="3">3</option>
											<option value="4">4</option>
											<option value="5">5</option>
											<option value="6">6</option>
											<option value="7">7</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>System</td>
									<td>
										<select name="system">
											<option value="0">Quarter</option>
											<option value="1">Semester</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
								</tr>
							</table>
							<table align="center" cellpadding="10px">
								<tr>
									<td>
										<input type="submit" value="Next" />
									</td>
								</tr>
							</table>
						</form>
						
						<% //} %>

						<div class="roundbottom">
							<img src="/images/bottoml.gif" alt="" width="15" height="15"
								class="corner" style="display: none" />
						</div>
					</div></td>
			</tr>
		</table>
		
	<div id="footer">
		<p>Copyright © 2011 Eric Y. Chung. All rights reserved.</p>
	</div>
</body>
</html>